{% extends "base.html" %}
{% block css %}
    <link href="static/css/dropzone.css" rel="stylesheet">
{% endblock %}
{% block content %}
<main class="app-content">
  <div class="app-title">
    <div>
      <h1><i class="fa fa-th-list"></i>&nbsp;POC管理</h1>
      <p></p>
    </div>
    <ul class="app-breadcrumb breadcrumb side">
      <li class="breadcrumb-item"><i class="fa fa-home fa-lg"></i></li>
      <li class="breadcrumb-item">首页</li>
      <li class="breadcrumb-item active"><a href="#">POC列表</a></li>
    </ul>
  </div>
  <div class="row">
    <div class="col-md-12">
      <div class="tile">
        <div class="tile-body">
            <div id="sampleTable_wrapper" class="dataTables_wrapper container-fluid dt-bootstrap4 no-footer">
                <div class="row"><div class="col-sm-12 col-md-6">
                    <div class="dataTables_length" id="showDeleteDiv">
                        <a class="btn btn-primary" href="#" data-target="#newPlugin" data-toggle="modal" title="Add Plugins">
                            <i class="fa fa-gitlab fa-lg"></i> 添加POC</a>
                        <br>
                        <br>
                    </div>
                </div>
            </div>

          <table class="table table-hover table-bordered" id="sampleTable">
            <thead>
              <tr class="text-center">
                  <th>
                      <input title="checkbox_all" onclick="selectAll();showDelete()" type="checkbox" name="allSelect" value="1" />
                  </th>
                  <th>POC</th>
                  <th>应用</th>
                  <th>版本</th>
                  <th>类型</th>
                  <th>时间</th>
                  <th>任务数量</th>
                  <th>漏洞数量</th>
                  <th>管理</th>
              </tr>
            </thead>
            <tbody>
            {% for i in plugin_info %}
                <tr class="center">
                    <td class="text-center">
                        <input title="checkbox" type="checkbox" onclick="showDelete()" name='select_id' value="{{ i['_id'] }}" />
                    </td>
                    <td>
                        <a href="vulnerability?plugin={{ i['_id'] }}">{{ i['plugin_name'] }}</a>
                    </td>
                    <td>{{ i['plugin_app'] }}</td>
                    <td>{{ i['plugin_version'] }}</td>
                    <td>{{ i['plugin_type'] }}</td>
                    <td>{{ i['plugin_date'] }}</td>
                    <td>{{ i['task_num'] }}</td>
                    <td>{{ i['vul_num'] }}</td>
                    <td class="text-center">
                        <div class="hidden-sm hidden-xs action-buttons">
                            <a onclick="plugin_info('{{ i['_id'] }}')"  role="button" data-target="#pluginInfo" data-toggle="modal" href="#" title="Plugin Info" >
                                <i class="fa fa-search-plus"></i>
                            </a>
                            &nbsp;&nbsp;&nbsp;

                            <a id="test1" role="button" href="#" rel="{{ i['_id'] }}"  onclick="delete_plugin('{{ i['_id'] }}')" title="delete">
                                <i class="fa fa-trash-o"></i>
                            </a>
                        </div>
                    </td>
                </tr>
            {% endfor %}
            </tbody>
          </table>
            <div class="modal" id="pluginInfo" >
                <div class="modal-dialog" role="document">
                    <div class="modal-content">
                        <div class="modal-header">
                            <h5 class="modal-title">插件信息</h5>
                            <button class="close" type="button" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                        </div>
                        <div class="modal-body">
                            <pre id="plugin_info" title="Plugin Info">Loading...</pre>
                        </div>
                        <div class="modal-footer">
                            <button class="btn btn-primary" type="button" data-dismiss="modal">Close</button>
                        </div>
                    </div><!-- /.modal-content -->
                </div><!-- /.modal-dialog -->
            </div><!-- /.modal -->

            <div class="modal" id="newPlugin" >
                <div class="modal-dialog" role="document">
                    <div class="modal-content">
                        <div class="modal-header">
                            <h5 class="modal-title">添加POC</h5>
                            <button class="close" type="button" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                        </div>
                        <div class="modal-body">

                            <form action="#" class="dropzone">
                                <div class="fallback">
                                    <input name="file" type="file" multiple />
                                </div>
                            </form>
                            <br>
                            <p class="help-block"><a>允许批量上传</a>
                                <br>
                                POC开发指南:
                                <a href="https://github.com/knownsec/Pocsuite/wiki/How-to-get-started-with-writing-a-POC-module" target="view_window">Pocsuite PoC </a>


                            </p>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-secondary"  data-dismiss="modal" aria-hidden="true">Cancel
                            </button>
{#                            <button class="btn btn-primary " id="upload-plugin" type="button">#}
{#                                <span>OK</span>#}
{#                            </button>#}
                        </div>
                    </div><!-- /.modal-content -->
                </div><!-- /.modal-dialog -->
            </div><!-- /.modal -->
            </div>
        </div>
      </div>
    </div>
  </div>
</main>

{% endblock %}
{% block js %}
    <!-- Data table plugin-->
    <script type="text/javascript" src="static/js/plugins/jquery.dataTables.min.js"></script>
    <script type="text/javascript" src="static/js/plugins/dataTables.bootstrap.min.js"></script>
    <script src="static/js/plugins/sweetalert/sweetalert.min.js"></script>
    <script src="static/js/plugins/dropzone.js"></script>
    <script src="static/js/server/plugin-management.js"></script>
    <script src="static/js/plugins/xss_filter.js"></script>
{% endblock %}
